set script_workerInit {
	set mainThread ""
	set loggerThread ""

	proc init { mainThreadId loggerThreadId } {
		global mainThread loggerThread
		set mainThread $mainThreadId
		set loggerThread $loggerThreadId

		source "./inc/inet.tcl"
		source "./inc/utils.tcl"
		source "./inc/log.tcl"
	}

	proc scanNetwork { firstAddress addressCount } {
		global mainThread
		if { $mainThread == "" || ![ thread::exists $mainThread ]} {
			return false
		}

		interp alias {} nextAddress {} _nextAddress $firstAddress
		proc _nextAddress { nextAddr } {
			set nextIpAddress [ inet_ntoa [ expr [ inet_aton $nextAddr ] + 1 ] ]
			interp alias {} nextAddress {} _nextAddress $nextIpAddress
			return $nextAddr
		}
		for { set i 0 } { $i < $addressCount } { incr i } {
			set newAddress [ nextAddress ]
			if {[ hostIsUp $newAddress ]} {
				thread::send -async $mainThread [ list onHostAlive $newAddress ]
			}
		}
		thread::send -async $mainThread [ list onScanningDone [ thread::id ] ]
	}

	thread::wait
}
